#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
    , workerThread(new WorkerThread())
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    workerThread->wait();
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    qDebug() <<QStringLiteral("设置标志为true");
    workerThread->setExitStop(true);
}

void Widget::on_pushButton_2_clicked()
{
    qDebug() <<QStringLiteral("马上调terminate暴力终止");
    workerThread->terminate();
}

void Widget::on_pushButton_3_clicked()
{
    workerThread->start();
}
